package com.cdream.basic.algorithm.leetcode.string;

import cn.hutool.core.util.NumberUtil;

/**
 * @author cdream
 * @date 6/23/20
 */
public class Offer15 {
    public int hammingWeight(int n) {
        int count = 0;
        while (n != 0) {
           n&=(n-1);
           count++;
        }
        return count;
    }

    public static void main(String[] args) {
        System.out.println(NumberUtil.binaryToInt("10000000000000000000000000000000"));
        // new Offer05().hammingWeight(NumberUtil.binaryToInt("00000000000000000000000000000000"));
    }
}
